<?php
	$start = microtime(true);
	require_once ("./config.inc.php");
	require_once ("./include/mysql.inc.php");
	require_once ("./include/link.inc.php");
	require_once ("./include/pageview.inc.php");
	require_once ("./include/articleType.inc.php");
	
	$articleTypeDao = new ArticleType();
	$articleTypeRows = $articleTypeDao->queryInfo();
	//友情链接
	$linkDao = new Link();
	$linkRows = $linkDao->query();
	//访问量
	$pageviewDao = new PageView();
	if (empty($_SESSION['pv'])) {
		$pageviewDao->addOneView();
		$_SESSION['pv'] = 1;
	}
?>
<div class="sidebar">
	<h3><a href="list.php?page=1">Diary</a></h3>
	<?php foreach ($articleTypeRows as $type) { ?>
		<p>
		<div style="float:left">
			<a class="tag" href="list.php?id=<?php echo $type[id]; ?>&page=1">&nbsp;<?php echo $type[name]; ?>&nbsp;</a>
		</div>
		<div style="float:right"><?php echo substr($type[time], 0, 10); ?>&nbsp;&nbsp;
			<a class="tag">&nbsp;<?php echo empty($type[num]) ? '0' : $type[num]; ?>&nbsp;</a>
		</div>
		<p>
	<?php } ?>
	<p></p>
	<!-- 友情链接 -->
	<h3><a>Link</a></h3>
	<ul>
		<?php foreach ($linkRows as $link) { ?>
			<li><a href="<?php echo $link[link]; ?>" target="_blank"><?php echo $link[name]; ?></a></li>
		<?php } ?>
	</ul>
	 <!-- 访问量 -->
	 <h3><a>Access</a></h3>
	 <p>Today: <a><?php echo $pageviewDao->queryTodayView(); ?></a>&nbsp;&nbsp;&nbsp;Total: <a><?php echo $pageviewDao->queryTotalView(); ?></a></p>
	 <p>Page Speed: 
	 	<a><?php echo number_format((microtime(true) - $start), 3); ?></a>&nbsp;&nbsp;s
	 </p>
	 <p></p>
	 <h3><a>Feed</a></h3>
	<!--以下是QQ邮件列表订阅嵌入代码-->
	<a target="_blank" href="http://list.qq.com/cgi-bin/qf_invite?id=f6c7ee01862474b8b77fa059e86cb8c36b441c4f8986d645"><img border="0" alt="填写您的邮件地址，订阅我们的精彩内容：" src="http://rescdn.list.qq.com/zh_CN/htmledition/images/qunfa/manage/picMode_light_s.png" /></a>
	&nbsp;
	<a target="_blank" href="http://sighttp.qq.com/authd?IDKEY=03e6a5d1fb82bb2e05d0d4a31348364bfd75c826bf27cabc"><img border="0"  src="http://wpa.qq.com/imgd?IDKEY=03e6a5d1fb82bb2e05d0d4a31348364bfd75c826bf27cabc&pic=46" alt="点击这里给我发消息" title="点击这里给我发消息"></a>
	&nbsp;
	<a href="./articleRss.php" target="_blank"><img width="24px" height="24px" src="./res/icons/rss_32.png"></img></a>
	<p></p>
	<!-- google ad
	<script type="text/javascript">
		google_ad_client = "ca-pub-7292810486004926";
		/* Homepage_right */
		google_ad_slot = "3103930020";
		google_ad_width = 200;
		google_ad_height = 200;
	</script>
	<script type="text/javascript"
		src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
	</script>
	 -->
	 <!-- 搜索
	<h3>Search Site</h3>
	<form id="search_form">
		<p>
			<input class="search" type="text" name="search_field" value="Enter keywords....." /> 
			<input name="search" type="image" onclick="javascript:toast('TODO');" style="border: 0; margin: 0 0 -9px 5px;" src="style/search.png" alt="Search" title="Search" />
		</p>
	</form>
	-->
</div>